package com.matrix.java.chap_04.example;

import java.util.Scanner;

public class Case4_01 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("A: ");
        double x1 = input.nextDouble();
        double y1 = input.nextDouble();
        System.out.print("B: ");
        double x2 = input.nextDouble();
        double y2 = input.nextDouble();
        System.out.print("C: ");
        double x3 = input.nextDouble();
        double y3 = input.nextDouble();
        double c = Math.sqrt(Math.pow(x1 - x2, 2.0D) + Math.pow(y1 - y2, 2.0D));
        double b = Math.sqrt(Math.pow(x1 - x3, 2.0D) + Math.pow(y1 - y3, 2.0D));
        double a = Math.sqrt(Math.pow(x3 - x2, 2.0D) + Math.pow(y3 - y2, 2.0D));
        if (!(a + b > c) && !(a + c > b) && !(b + c > a)) {
            System.out.println("输入错误");
        } else {
            double A = Math.toDegrees(Math.acos((a * a - b * b - c * c) / (-2.0D * b * c)));
            double B = Math.toDegrees(Math.acos((b * b - a * a - c * c) / (-2.0D * a * c)));
            double C = Math.toDegrees(Math.acos((c * c - a * a - b * b) / (-2.0D * b * a)));
            System.out.println("A: " + A + "B: " + B + "C: " + C);
        }
        input.close();
    }
}
